package com.yan.Junt;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

import java.text.SimpleDateFormat;


public class junt {

    public static String getsong(Object o, String s) throws JsonProcessingException {

        ObjectMapper mapper = new ObjectMapper();

        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false);
        SimpleDateFormat format = new SimpleDateFormat(s);
        mapper.setDateFormat(format);
      //  Date date = new Date();
        String ss = mapper.writeValueAsString(o);

        return ss;


    }


    public static String getsong(Object o) throws JsonProcessingException {


        return junt.getsong(o,"yyyy-MM-dd HH:mm:ss");


    }
}
